1. Field of the Invention
The present invention relates to a data processing method and apparatus for a vehicle, whereby a plurality of serial data are selectively read to be processed and, more particularly, to a method and apparatus for vehicular data processing which are suited for a vehicle anti-theft device which reads a key ID code registered beforehand in an engine key or the like and a reference ID code registered beforehand in a vehicle memory, and enables the start of an engine provided that these two ID codes satisfy a predetermined relationship.
2. Description of the Prior Art
Various types of anti-theft apparatuses have been proposed. Among those anti-theft apparatuses, there is one that is designed to immobilize a vehicle by electrical means if an attempt is made to start or drive the vehicle by using an illegitimate key. This is achieved by previously storing an identification code or a key ID code in a key, reading the key ID code when the key is inserted into a key cylinder to start up the engine, comparing It with a reference ID code prestored In the vehicle, generating an enable signal only when there is a match between both ID codes, and enabling the engine to be started up only when an engine control unit successfully receives that signal; see "Car Technology", Vol. 48, No. 8, 1994, pp. 59-64.
An example of such a conventional transponder type immobilizer is shown in FIG. 6. A key 2 includes a memory (not shown) In which a key ID code (for instance, of 64 bits) is prestored, and a transmitter 4 for transmitting the key ID code. The transmitter 4 of the key 2 and a key cylinder 5 are coupled together by, for instance, an induction coil (antenna) 6.
When the key 2 is inserted into the key cylinder and turned to the ignition ON position, an ignition switch 7 is closed. In response to this, an immobilizer CPU 13 incorporated in a hybrid IC for immobilizer control (immobilizer HIC)10 In an engine control unit (ECU) 30 operates, and operating electric power is supplied from a power amplifier in an antenna unit 19 to the transmitter 4 through the induction coil (antenna) 6. The antenna unit 19 is electrically connected to ECU 30 by a pair of connectors 40 and 50, along with terminal devices of the drive and control systems essential to the engine control such as a fuel injection valve 17 and a fuel pump 18. The moment electric power is supplied to the transmitter 4, the transmitter 4 reads the ID code stored in the key 2 and periodically and continuously sends the ID code In sequence to the key cylinder 5 as long as the ignition stays ON.
The received key ID code is amplified by a power amplifier (not shown) in the antenna unit 19, and read into the immobilizer CPU 13 through an I/F circuit 12 In the immobilizer HIC 10, and temporarily stored in an appropriate ID code register 13B. In an EEPROM 14 of the HIC 10, a unique reference ID code assigned to each vehicle is prestored, and the reference ID code and the key ID code which was read in are compared with each other by a compare unit 13S of the CPU 13. If it is determined that there is a match between the two or they are in a predetermined relationship, an enable signal is transmitted from the compare unit 13S to an engine CPU 16. At the same time, a starter relay is activated to initiate the rotation of a starter motor (not shown).
In a ROM 15 of the engine CPU 16, an engine control program is stored which includes at least an engine control algorithm, an I/O (Input/Output) control algorithm and an anti-theft algorithm. The engine CPU 16 operates according to the engine control program, and discriminates and verifies the reception of an enable signal by the anti-theft algorithm. If the enable signal is correct data, the engine CPU 16 performs a specific control based on the engine control algorithm for the respective terminal devices such as a fuel injection valve 17, a fuel pump 18 and an ignition control unit 20 on the signal port selected by the I/O control algorithm, thereby to enable the start-up of the engine and running of the vehicle.
If the reference ID code stored in the EEPROM 14 and the key ID code transmitted from the key 2 and read in do not match each other or they are not in a predetermined relationship, the compare function unit 13S does not issue an enable signal. Accordingly, the start of the vehicle by the engine CPU 16 is inhibited, and a horn 21 is activated by the CPU 13 to provide an appropriate alarm and display. When the enable signal transmitted from the compare unit 13S is not correct data, the start of the vehicle by the engine CPU 16 is also Inhibited. Thus, the illegal startup of the engine and the driving of the vehicle by a wrong key are prevented to ensure the vehicle anti-theft function.
In the conventional transponder type immobilizer described above, the key ID code stored in the key 2 and the reference ID code stored in the EEPROM 14 are alternately read into the CPU 13 by the serial communication system. The reading of the reference ID code out of the EEPROM 14 is initiated in response to a request received from the CPU 13. The key ID code is independently and repeatedly sent out of the transmitter 4 via the antenna unit 19 asynchronously with the operation of the CPU 13.
For the reason stated above, the timing at which a pulse related to the leading data of the key ID code is transmitted does not necessarily coincide with the input timing of the key ID code in the CPU 13. Hence, if the input timing in the CPU 13 is encountered in the middle of sending the key ID code, then the CPU 13 must wait for the transmitting timing of a head of the next key ID code before it can start inputting of the key ID code, presenting a problem such as delay in the subsequent processing.
FIG. 4 and FIG. 5 are the timing charts which show the relationships between the ON/OFF of the ignition switch (IG), pulse signal Px of the key ID code, the input processing of the key ID code, and the reading of the reference ID code. In the timing charts, (a) and (b) indicate two different prior art arrangements whereas (c) depicts the present invention. Key ID code pulse signal Px is comprised of a data pulse train PD which denotes the key ID code, and a leading pulse P1 which is added at the beginning of each data pulse train PD to clarify a break between two successive PD data pulse trains. FIG. 4 shows a case wherein the first key ID code pulse detected immediately after the ignition is actuated, is the leading pulse P1; FIG. 5 shows a case wherein the aforesaid first key ID code is not the leading pulse P1.
According to the first prior art arrangement shown in FIG. 4(a), each time a change (rising up or falling down) In ID code pulse signal Px is detected, interrupt processing for the input of the key ID code is performed with a priority. Hence, when the Ignition switch is turned ON at time to, the reference ID code is first read until a change in ID code pulse signal Px is detected. If a fall in the key ID code pulse Px is detected at time t2, interrupt processing for the input of the key ID code then takes place and the reading of the reference ID is suspended. After that, when the input processing of the key ID code is completed at time t4, the reading of the reference ID code is resumed.
If, however, another fall in the key ID code pulse signal Px is detected at time t5, then there will be another Interruption of the input processing of the key ID code even though the input of the key ID code has been completed, thus suspending the reading of the reference ID code. This causes completion of the reading of the reference ID code to be delayed to time t9; therefore, the key ID code cannot be compared and checked until time t9.
According to the second prior art arrangement shown in FIG. 4(b), priority is given to the reading of the reference ID code. When the ignition switch is turned ON at time t0, the reading of the reference ID code begins at time t1 and when its reading is completed at time t3, the input processing of the key ID code is initiated. If leading pulse P1 of the key ID code cannot be detected at time t3, i.e. if data pulse train PD cannot be read from the first data pulse, then the program must wait until the next leading pulse P1 is finished at time t5 before It begins the input processing of the key ID code. This results in a wasteful waiting time (loss time) with a consequent delay in comparing and checking timing of the ID code.
As illustrated in FIG. 5, when the key ID code pulse detected first after the ignition switch is turned ON at time t0, is not leading pulse P1, the input processing of the key ID code is begun at time t1 according to the first prior art arrangement (a); however, no substantially effective input is performed. Effective input is started at time t5 at which the next leading pulse P1 falls down, thus causing a wasteful time. According to the second prior art arrangement (b), a middle of the key ID code is being output at time t6 at which the reading of the reference ID code is completed and the program therefore waits until time t9 at which the next leading pulse P1 falls before it can start the input processing of the key ID code. The second prior art, therefore, also presents a problem of significant waste of time.